package com.wyz.saas.module.chat.bean.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.wyz.saas.module.chat.bean.User
import kotlinx.coroutines.flow.Flow

@Dao
interface UserDao {

    @Query("SELECT * FROM table_user ORDER BY name ASC")
    fun getAlphabetizedWords(): List<User>

    @Query("SELECT * FROM table_user ORDER BY name ASC")
    fun getAlphabetizedWordsByFlow(): Flow<List<User>>

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    fun insert(user: User)

    @Query("DELETE FROM table_user")
    fun deleteAll(): Int

}